<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>12306自动下单</title>
    <meta charset="utf-8">
	<title>Bootstrap 实例 - 水平表单</title>
	<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
	<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
		.list {
			width:80%;
		}
		.form-horizontal {
			width:80%;
		}
        #st{
            margin-left: 50px;
        }
    </style>
</head>
<body>
<center>
        <h3 class="text-center">12306自动下单</h3>
        <form class="form-horizontal" role="form" method="POST">
            {%csrf_token%}
            <div class="form-group">
        		<label for="firstname" class="col-sm-2 control-label">日期</label>
        		<div class="col-sm-10">
					{% if train_date %}
        			<input type="text" class="form-control" id="firstname" name="train_date" placeholder="请输入日期:(2017-10-15)" value="{{train_date}}">
					{% else %}
					<input type="text" class="form-control" id="firstname" name="train_date" placeholder="请输入日期:(2017-10-15)" >
					{% endif %}
        		</div>

        	</div>
        	<div class="form-group">
        		<label for="firstname" class="col-sm-2 control-label">出发地</label>
        		<div class="col-sm-10">
					{% if train_start %}
        			<input type="text" class="form-control" id="firstname" name="dp" placeholder="请输入出发地点" value="{{ train_start }}">
					{% else %}
					<input type="text" class="form-control" id="firstname" name="dp" placeholder="请输入出发地点" ">
					{% endif %}
        		</div>

        	</div>
        	<div class="form-group">
        		<label for="lastname" class="col-sm-2 control-label">到达地</label>
        		<div class="col-sm-10">
					{% if train_arrive %}
        			<input type="text" class="form-control" id="lastname" name="ar" placeholder="请输入到达地点" value="{{train_arrive}}">
					{% else %}
					<input type="text" class="form-control" id="lastname" name="ar" placeholder="请输入到达地点" ">
					{% endif %}
        		</div>
        	</div>


        	<div class="form-group">
        		<div class="col-sm-offset-2 col-sm-10">
                    <input type="submit" class="btn btn-default">
        		</div>
        	</div>
        </form>

	{% if train %}
    <h1>火车票信息</h1>
    <h3>出发站:{{ train_start }}&nbsp;&nbsp;&nbsp;&nbsp;到达站:{{train_arrive}}</h3>

<div class="list" >


        <br>
        <br>
         <form action="../login/" method="GET">
        <input type="checkbox" id="st" name="seat" value="O">二等座 &nbsp;&nbsp;
        <input type="checkbox" id="st" name="seat" value="M">一等座&nbsp;&nbsp;
        <input type="checkbox" id="st" name="seat" value="1">硬座&nbsp;&nbsp;
        <input type="checkbox" id="st" name="seat" value="3">硬卧&nbsp;&nbsp;
        <input type="checkbox" id="st" name="seat" value="4">软卧&nbsp;&nbsp;
        <table border="1" style="border-collapse: collapse" class="table table-striped table-bordered table-hover mytable">
        <tr>
            <th>出发站</th>
            <th>到达站</th>
            <th>乘车日期</th>
            <th>车次</th>
            <th>出发时间</th>
            <th>到达时间</th>
            <th>历时</th>
            <th>软卧</th>
            <th>特等座</th>
            <th>无座</th>
            <th>硬卧</th>
            <th>硬座</th>
            <th>二等座</th>
            <th>一等座</th>
            <th>购票</th>
        </tr>
        {% for i in train %}

                {% csrf_token %}



                <td>{{ i.6 }}</td>
                <td>{{ i.7 }}</td>
                <td>{{ train_date }}</td>
                <td>{{ i.3}}</td>
                <td>{{ i.8 }}</td>
                <td>{{ i.9 }}</td>
                <td>{{ i.10 }}</td>
                <td>{{ i.23 }}</td>
                <td>{{ i.25 }}</td>
                <td>{{ i.26 }}</td>
                <td>{{ i.28 }}</td>
                <td>{{ i.29 }}</td>
                <td>{{ i.30 }}</td>
                <td>{{ i.31 }}</td>


                <td id="tj"><a href="../login/?start_station={{ i.6 }}&arrive_station={{ i.7 }}&train_date={{ train_date }}&train_no={{ i.3 }}&seat={{ seat }}&start_time={{ i.8 }}&arrive_time={{ i.9 }}">预定</a></td>
            </form>
            <tr>
          <!-- <button type="submit">预定</button> -->
        </tr>
        {% endfor%}
    </table>


    {% endif %}
    <!--<a href="{ % url "logins" %}" >登录12306</a>-->
    <br>
    <br>
    </div>
{#登录界面#}
    <div class="main">
        <h3 class="text-center">12306登录</h3>
        <h6 class="text-center">登录后,选择乘车人!</h6>
        <form class="form-horizontal" role="form" method="POST">
            {%csrf_token%}
            <div class="form-group">
        		<label for="firstname" class="col-sm-2 control-label">账号</label>
        		<div class="col-sm-10">
        			<input type="text" class="form-control" id="firstname" name="username"
        				   placeholder="请输入12306账号">
        		</div>

        	</div>
        	<div class="form-group">
        		<label for="firstname" class="col-sm-2 control-label">密码</label>
        		<div class="col-sm-10">
        			<input type="password" class="form-control" id="firstname" name="password"
        				   placeholder="请输入12306密码">

        		</div>

        	</div>
        	<div class="form-group">
        		<div class="col-sm-offset-2 col-sm-10">
                    <input type="submit" class="btn btn-default">
        		</div>
        	</div>
        </form>
        </div>
</center>
</body>
</html>